<?php
/**
  * @version $Id: install.mojo.php,v 0.16 2007/12/07 11:55:55 visualweb Exp $ 
  * @package com_mojo
  * @copyright (c) 1guywebdesign.com 
  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL 
  *
  *	added user tables
  *	renamed component
  *	cleaned up install and uninstall xml
  * created hooks for future upgrade from dashboard capabilities
  */

// set absolutes, extend user roles to include joomla admin
function com_install() {
    global $database, $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_mailfrom, $mosConfig_dbprefix;
    $path1= $mosConfig_live_site.'/components/com_mojo'; 
    $meta1 = $mosConfig_dbprefix.'wp_user_level';
    $meta2 = $mosConfig_dbprefix.'wp_capabilities';
    $opt = $mosConfig_dbprefix.'wp_user_roles';
    $level = 'a:1:{s:13:"administrator";b:1;}';
   
// Create mojo icon to display in global admin menu (penguinBeta -kdm)
    $database->setQuery("UPDATE #__components SET admin_menu_img='../components/com_mojo/wp-admin/images/mojomenu.png' WHERE admin_menu_link='option=com_mojo'");
    $iconresult[1] = $database->query();
    
	$query = "UPDATE #__wp_options"
		. "\n SET option_value = '$path1'"
		. "\n WHERE option_id = 1"
		;
	$database->setQuery( $query );
	$database->query() or die( $database->stderr() );
	
	$query = "UPDATE #__wp_options"
		. "\n SET option_value = '$mosConfig_mailfrom'"
		. "\n WHERE option_id = 6"
		;
	$database->setQuery( $query );
	$database->query() or die( $database->stderr() );

	$query = "UPDATE #__wp_options"
		. "\n SET option_value = '$path1'"
		. "\n WHERE option_id = 40"
		;
	$database->setQuery( $query );
	$database->query() or die( $database->stderr() );

	$query = "UPDATE #__wp_options"
		. "\n SET option_name = '$opt'"
		. "\n WHERE option_id = 62"
		;
	$database->setQuery( $query );
	$database->query() or die( $database->stderr() );
	
	$query = "INSERT INTO #__wp_options VALUES (29, 0, 'links_recently_updated_prepend', 'Y', 1, '<em>', 20, 8, '', 1, 'yes')";
	$database->setQuery( $query );
	$database->query() or die( $database->stderr() );
	$query = "INSERT INTO #__wp_options VALUES (30, 0, 'links_recently_updated_append', 'Y', 1, '</em>', 20, 8, '', 1, 'yes')";
	$database->setQuery( $query );
	$database->query() or die( $database->stderr() );

	$query = "INSERT INTO #__wp_usermeta VALUES (1, 62, '$meta1', '10')";
	$database->setQuery( $query );
	$database->query() or die( $database->stderr() );
	$query = "INSERT INTO #__wp_usermeta VALUES (2, 62, '$meta2', '$level')";
	$database->setQuery( $query );
	$database->query() or die( $database->stderr() );
	
    // Show basic install results to user
?>
<div style="border: 1px solid #f0f0f0; display:block; font-family: trebuchet, arial, tahoma, sans-serif; font-size:12px;margin: 24px auto; padding: 4px; position:relative; width: 600px;">
<div style="background:#fffeec; border:1px solid #f0f0f0; display:block; margin: 0 auto; padding: 12px; position:relative; text-align:left;">
      <h3>Congratulations...</h3>
      <p>You've got your <b>MOJO</b> on!</p>
      <p>With mojoBlog you can have your cake -and- eat it too! mojoBlog supports many popular wordpress plugins, uses native joomla template styles as well as upcoming mojoBlog "themeplates" and a growing number of supported joomla modules and plugins.</p>
      <h3>Update/Compatibility Check...</h3>
		<p>mojoBlog is still very much beta.  You've just installed version <em style="color:green;">0.16</em> which is a nice vintage but may not be the most current or stable version.  To find the most current release visit the official mojoBlog support website at <a href="http://www.joomlify.com" title="mojoblog home, forums and accessories"> http://www.joomlify.com. </a></p>
		<h3><span style="color:red;">Important!</span></h3>
		<p>You need to <strong>create a new menu</strong> for mojoBlog. Choose the menu you wish to add mojoblog to from your <em>admin/menu</em> above, select the "new" icon (top right) and, in the menu screen tick "component" from the left column options. When the component window appears, scroll down the list until you see (and select) "mojoBlog". Name your new menu item whatever you like and click save.
		</p>
		<p>Lastly, you should spend a few minutes in your new mojoBlog configuring things the way you like.  enjoy your new mojo!
		</p>
<div style="display:none;">
      <h3>mojoBlog Installation Options.</h3>
      <p>You're almost done.  First however, there's a little housecleaning left to do.  Below there's three options which offer three ways to complete your installation of mojoBlog.</p>

		<p><strong>Option 1. <span style="color:#666;">Fresh Install</span></strong><br />
		To complete your Fresh/Clean installation of mojoBlog we'll need to create some database tables and import a few, basic configuration options (most of which you can change once you're logged in to your mojoBlog dashboard). If this is the first time you've installed mojoBlog and you've never used or installed jd-wp (com_jd-wp). Click <a href="#">here to continue</a>.
		</p>
		<p><strong>Option 2. <span style="color:#666;">Upgrade mojoBlog</span></strong><br />
		If you are upgrading from a previous installation of mojoBlog and would like to keep your older posts, comments and  category structure. Click <a href="#">here to continue</a>.
		</p>
		<p><strong>Option 3.<span style="color:#666;"> Upgrade jd-wp</span></strong><br />
		If you want to upgrade from an older version of jd-wp (com_jd-wp) or nuWordpress (also com_jd-wp). Click <a href="#">here to continue</a>.
		</p>
</div>
      <br />
      <p style="text-align:center!important;">mojoBlog is released under the terms and conditions of the <a href="index2.php?option=com_admin&amp;task=license">GNU General Public License</a>.</p>
      <br />
      		<div style="background:fff; border:1px dashed pink; display:block; margin: 8px; padding: 12px; ">
		<p><span style="font-weight:bold;">Joomla!1.5 and Mambo folk:</span><br />MojoBlog is -ONLY- compatible with joomla!/a8ejoomla 1.0.12 or newer 1.0.13 (preferred).<br />e.g.:<em> It will not work with joomla! 1.5 or joomla 1.5 in legacy mode or any flavor of Mambo CMS. </em> </p>
		</div>
</div>
</div>
      <p style="text-align:center!important;">Your mojoBlog installation was wildly <span style="color:#accc39">successful !</span></p>

<?php
}
?>